package com.piaohailin.feature.swagger;

import com.piaohailin.feature.jjwt.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: piaohailin
 * @Date: 2019-07-08 14:25
 */

//@Api(value = "系统用户接口", tags = "系统管理")
//@RestController
//@RequestMapping("/v3/edu/users")
//public class UserController {
//
//    @Autowired
//    private UserService userService;
//
//    /**
//     * 添加用户，注册
//     *
//     * @param loginName
//     *      登录账号
//     * @param userName
//     *      用户名称
//     * @param password
//     *      登录密码
//     * @param roleId
//     *      用户角色
//     * @return
//     * @throws ResourceExistsException
//     */
//    @ApiOperation(value = "添加用户")
//    @PostMapping("/")
//    public JsonResult create(
//            @ApiParam(name = "loginName", value = "登录账号", required = true) @RequestParam(required = true) @RequestBody String loginName,
//            @ApiParam(name = "userName", value = "用户名称", required = true) @RequestParam(required = true) @RequestBody String userName,
//            @ApiParam(name = "password", value = "登录密码", required = true) @RequestParam(required = true) @RequestBody String password,
//            @ApiParam(name = "roleId", value = "用户角色编号", required = true) @RequestParam(required = true) @RequestBody String roleId)
//            throws ResourceExistsException {
//        boolean exists = this.userService.exists(loginName);
//        if (exists) {
//            throw new ResourceExistsException(loginName);
//        }
//        User user = userService.create(loginName, password, userName, roleId);
//        return new JsonResult(user);
//    }
//}@Api(value = "系统用户接口", tags = "系统管理")
//@RestController
//@RequestMapping("/v3/edu/users")
//public class UserController {
//
//    @Autowired
//    private UserService userService;
//
//    /**
//     * 添加用户，注册
//     *
//     * @param loginName
//     *      登录账号
//     * @param userName
//     *      用户名称
//     * @param password
//     *      登录密码
//     * @param roleId
//     *      用户角色
//     * @return
//     * @throws ResourceExistsException
//     */
//    @ApiOperation(value = "添加用户")
//    @PostMapping("/")
//    public JsonResult create(
//            @ApiParam(name = "loginName", value = "登录账号", required = true) @RequestParam(required = true) @RequestBody String loginName,
//            @ApiParam(name = "userName", value = "用户名称", required = true) @RequestParam(required = true) @RequestBody String userName,
//            @ApiParam(name = "password", value = "登录密码", required = true) @RequestParam(required = true) @RequestBody String password,
//            @ApiParam(name = "roleId", value = "用户角色编号", required = true) @RequestParam(required = true) @RequestBody String roleId)
//            throws ResourceExistsException {
//        boolean exists = this.userService.exists(loginName);
//        if (exists) {
//            throw new ResourceExistsException(loginName);
//        }
//        User user = userService.create(loginName, password, userName, roleId);
//        return new JsonResult(user);
//    }
//}